package com.jxb.ractBase;

import java.util.Arrays;
import java.util.List;

import lombok.Builder;
import lombok.Data;
import reactor.core.publisher.Flux;

/**
 * 类注释
 *
 * @author jiaobo
 * @date Created in 2024/10/23 21:25
 **/
public class OperationsFlatMapTest {

    public static void main(String[] args) {
        Flux<User> userFlux=Flux.just(
                User.builder().id( 1 ).tags(Arrays.asList("80后", "技术管理", "资深技术专家", "极客精神" ) ).build(),
                User.builder().id( 2 ).tags( Arrays.asList( "技术管理","极客精神" ) ).build(),
                User.builder().id( 3 ).tags( Arrays.asList( "学霸","初学者" ) ).build() );

        userFlux.flatMap(item -> Flux.fromStream(item.getTags().stream())).subscribe(System.out::println);
    }



}

@Data
@Builder
class User{
    private Integer id;
    private List<String> tags;
}
